Ext.create('Ext.data.Store', {
    storeId: 'simpsonsStore',
    fields: ['name', 'email', 'phone'],
    data: [
        { name: 'Lisa', email: 'lisa@simpsons.com', phone: '555-111-1224' },
        { name: 'Bart', email: 'bart@simpsons.com', phone: '555-222-1234' },
        { name: 'Homer', email: 'homer@simpsons.com', phone: '555-222-1244' },
        { name: 'Marge', email: 'marge@simpsons.com', phone: '555-222-1254' }
    ]
});


Ext.define("Admin.view.decMakConsultation.NewConsultation", {
    extend: "Admin.common.container.BaseContainer",
    xtype: "newConsultation",
    alias: "newConsultation",
    controller: "newConsultation",
    requires: [
        "Ext.panel.Panel",
        "Ext.grid.Panel",
        "Ext.button.Button",
        "Admin.common.form.SearchFormPanel",
        "Admin.common.panel.EchartsPanel"
    ],
    height: 200,
    layout: {
        type: "vbox",
        align: "stretch" //拉伸使其充满整个父容器
    },
    // defaults: {
    //   cls: "shadow",
    //   style: "border: 1px solid #ccc"
    // },
    items: [{
            xtype: "panel",
            bodyPadding: 5,
            cls: 'shadow',
            style: 'border: 1px solid #ccc',
            height: 50,
            margin: "0 0 10 0",
            items: [{
                tbar: [{
                        xtype: "combobox",
                        maxWidth: 350,
                        fieldLabel: "会商名称",
                        labelWidth: 80,
                        valueField: "conId",
                        displayField: "conName",
                        reference: "meetingName",
                        listeners: {
                            added: function(combo) {
                                var _that = this;
                                var store = Ext.create("Ext.data.Store", {
                                    autoLoad: true,
                                    proxy: {
                                        type: "ajax",
                                        extraParams: { river: config.RIVER },
                                        url: config.URL + "szy/dispatch/meeting/ddsSCon/list",
                                        reader: {
                                            type: "json",
                                            rootProperty: "list",
                                            fields: ["conName", "conId"]
                                        }
                                    }
                                });
                                combo.setStore(store);
                                store.on('endupdate', function() {
                                    if (!combo.getValue()) {
                                        combo.setValue(store.getAt(0).get('conId'))
                                    }
                                });
                            },
                            change: "meetingChange"
                        }
                    },
                    "->",
                    {
                        xtype: "button",
                        text: "保存",
                        iconCls: "x-fa  fa-save",
                        handler: "saveScheme",
                        margin: "0 10 0 10"
                    }
                ]
            }]
        },
        //底部内容
        {
            xtype: "panel",
            flex: 1,
            layout: {
                type: "vbox",
                pack: "start",
                align: "stretch"
            },
            items: [{
                    xtype: 'grid',
                    title: '评分规则设置',
                    margin: "0 0 10 0",
                    cls: "shadow",
                    style: "border: 1px solid #ccc",
                    height: 183,
                    reference: "markGrid",
                    listeners: {
                        validateedit: 'updateGrid'
                    },
                    columns: [{
                            header: "类别",
                            dataIndex: "name",
                            align: "center",
                            flex: 1
                        },
                        {
                            header: "应急时长",
                            dataIndex: "F00001",
                            align: "center",
                            flex: 1,
                            editor: new Ext.form.Number({
                                allowBlank: false,
                                blankText: "功能不能为空",
                                maxValue: 100,
                                minValue: 0
                            })
                        },
                        {
                            header: "受影响取水口",
                            dataIndex: "F00002",
                            align: "center",
                            flex: 1,
                            editor: new Ext.form.Number({
                                allowBlank: false,
                                blankText: "功能不能为空",
                                maxValue: 100,
                                minValue: 0
                            })
                        },
                        {
                            header: "应急耗水量",
                            dataIndex: "F00003",
                            align: "center",
                            flex: 1,
                            editor: new Ext.form.Number({
                                allowBlank: false,
                                blankText: "功能不能为空",
                                maxValue: 100,
                                minValue: 0
                            })
                        },
                        {
                            header: "水头损失",
                            dataIndex: "F00004",
                            align: "center",
                            flex: 1,
                            editor: new Ext.form.Number({
                                allowBlank: false,
                                blankText: "功能不能为空",
                                maxValue: 100,
                                minValue: 0
                            })
                        }
                    ],
                    selModel: 'rowmodel',
                    plugins: {
                        ptype: 'rowediting',
                        clicksToEdit: 2
                    },
                },
                {
                    xtype: "panel",
                    flex: 1,
                    cls: "shadow",
                    style: "border: 1px solid #ccc",
                    layout: {
                        type: "vbox",
                        pack: "start",
                        align: "stretch"
                    },
                    defaults: {
                        flex: 1
                    },
                    curChecked: null,
                    items: [{
                            xtype: "gridpanel",
                            title: "方案评价结果",
                            reference: "resultGrid",
                            margin: '0 0 10 0',
                            columns: [{
                                    xtype: "radiocolumn",
                                    text: "选择方案",
                                    dataIndex: "flag",
                                    listeners: {
                                        radiocheckchange: function(me, index, record, group) {
                                            var gridpanel = me.up("gridpanel");
                                            gridpanel.curChecked = record.data.keys;
                                        },
                                    }
                                },
                                {
                                    text: "方案序号",
                                    dataIndex: "index",
                                    align: "center",
                                    flex: 1,
                                    renderer: function(value, record, dataIndex) {
                                        return (record.rowIndex + 1)
                                    }
                                },
                                {
                                    text: "备选方案",
                                    dataIndex: "name",
                                    align: "center",
                                    flex: 1
                                },
                                {
                                    text: "keys",
                                    dataIndex: "keys",
                                    align: "center",
                                    flex: 1,
                                    hidden: true
                                },
                                {
                                    text: "应急时长(h)",
                                    dataIndex: "F00001",
                                    align: "center",
                                    flex: 1
                                },
                                {
                                    text: "受影响取水口(个)",
                                    dataIndex: "F00002",
                                    align: "center",
                                    flex: 1
                                },
                                {
                                    text: "应急耗水量(万m³)",
                                    dataIndex: "F00003",
                                    align: "center",
                                    flex: 1
                                },
                                {
                                    text: "水头损失(m)",
                                    dataIndex: "F00004",
                                    align: "center",
                                    flex: 1
                                },
                                {
                                    text: "综合得分",
                                    dataIndex: "scores",
                                    align: "center",
                                    flex: 1
                                },
                                {
                                    xtype: "actioncolumn",
                                    text: "查看详情",
                                    align: "center",
                                    width: 120,
                                    sortable: false,
                                    menuDisabled: true,
                                    items: [{
                                        iconCls: "x-fa fa-edit",
                                        tooltip: "查看详情",
                                        handler: "expertUpdata"
                                    }]
                                }
                            ]
                        },
                        {
                            xtype: "panel",
                            layout: {
                                type: "hbox",
                                align: "stretch"
                            },
                            items: [{
                                    xtype: "echartspanel",
                                    flex: 0.25,
                                    etitle: "应急时长",
                                    yName: '应急时长(h)',
                                    reference: "echart1"
                                },
                                {
                                    xtype: "echartspanel",
                                    flex: 0.25,
                                    etitle: "受影响取水口",
                                    yName: '受影响取水口(个)',
                                    reference: "echart2"
                                },
                                {
                                    xtype: "echartspanel",
                                    flex: 0.25,
                                    etitle: "应急耗水量",
                                    yName: '应急耗水量(万m³)',
                                    reference: "echart3"
                                },
                                {
                                    xtype: "echartspanel",
                                    flex: 0.25,
                                    etitle: "水头损失",
                                    yName: '水头损失(m)',
                                    reference: "echart4"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
});


Ext.define('Admin.view.emergencyDispatch.ConsultationForm', {
    extend: 'Admin.common.form.BaseFormPanel',
    xtype: 'consultationForm',
    require: ['Admin.store.emergencyDispatch.NewPlanEventList'],
    alias: 'consultationForm',
    style: { padding: '15px 20px' },
    layout: 'anchor',
    viewModel: "ddsEdPModel",
    defaults: {
        anchor: '100%',
        labelWidth: 60,
        collapsible: true,
    },

    items: [{
            xtype: 'textfield',
            name: 'proNm',
            fieldLabel: '方案名称',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'evenNm',
            fieldLabel: '应急事件',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'pubDt',
            fieldLabel: '发生时间',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'pubDt',
            fieldLabel: '时间类型',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'producer',
            fieldLabel: '执行人',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'F00001',
            fieldLabel: '应急时长',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'F00002',
            fieldLabel: '受影响取水口(个)',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'F00003',
            fieldLabel: '应急消耗水量(万m³)',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'F00004',
            fieldLabel: '水头损失(m)',
            editable: false,
        },
        {
            xtype: 'textfield',
            name: 'scores',
            fieldLabel: '综合得分',
            editable: false,
        }

    ]
});